#define _CRT_SECURE_NO_WARNINGS 01
#include<stdio.h>
#include<string.h>

struct {
	char name[40];
	int age;
} person, person_copy;

int main()
{

	char myname[] = "Pierre de Fermat";

	/* using memcpy to copy string: */
	memcpy(person.name, myname, strlen(myname) + 1);
	person.age = 46;

	/* using memcpy to copy structure: */
	memcpy(&person_copy, &person, sizeof(person));

	printf("person_copy: %s, %d \n", person_copy.name, person_copy.age);

	return 0;


	/*char str[] = "memmove can be very useful......";
	memmove(str + 20, str + 15, 11);
	puts(str);
	return 0;*/

		//char myname[] = "Pierre de Fermat";

		///* using memcpy to copy string: */
		//memcpy(person.name, myname, strlen(myname) + 1);
		//person.age = 46;

		///* using memcpy to copy structure: */
		//memcpy(&person_copy, &person, sizeof(person));

		//printf("person_copy: %s, %d \n", person_copy.name, person_copy.age);

		//return 0;
	
	/*FILE* pFile;
	pFile = fopen("unexist.ent", "r");
	if (pFile == NULL)
		printf("Error opening file unexist.ent: %s\n", strerror(errno));
	return 0;*/

	/*char str[] = "- This, a sample string.";
	char* pch;
	printf("Splitting string \"%s\" into tokens:\n", str);
	pch = strtok(str, " ,.-");
	while (pch != NULL)
	{
		printf("%s\n", pch);
		pch = strtok(NULL, " ,.-");
	}
	return 0;*/
	/*char arr1[] = "abcdabcd";
	char arr2[] = "cda";
	printf("%s ",strstr(arr1,arr2));

	return 0;*/

	/*char arr1[] = "abc";
	char arr2[] = "adc";
	char arr3[] = "dcd";
	printf("%d \n", strncmp(arr1, arr2,2));
	printf("%d \n", strncmp(arr1, arr2,1));
	printf("%d \n", strncmp(arr3, arr1,3));
	return 0;*/

	/*char arr1[20]="practice ";
	char arr2[] = "for fun";
	printf("%s \n",strncat(arr1,arr2,3));
	printf("%s \n", arr1);
	return 0;*/
	//char arr1[20] = "i love ";
	//char arr2[] = "code!";
	//printf("%s \n", strcat(arr1,arr2));
	//printf("%s \n", arr1);

	//return 0;
	//char arr1[20];
	//char arr2[6] = "code";
	//printf("%s\n", strcpy(arr1,arr2));
	//printf("%s \n",arr1);
	//return 0;



	//char arr[] = "abcdefh";
	//printf("%d",strlen(arr));
	//return 0;
}
